package top.jandmla.excel.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import top.jandmla.excel.service.ShapService;
import top.jandmla.excel.service.serviceImpl.ShapServiceImpl;
import top.jandmla.excel.util.result.BaseResult;


@RestController
@RequestMapping("shape")
public class ShapController {

    @Autowired
    private ShapService shapService;

    @PostMapping("/upload")
    public BaseResult<String> uploadShapFile(@RequestParam("file") MultipartFile file) {
        return file != null ? BaseResult.success(shapService.startImport(file)) : BaseResult.fail(1, "上传文件为空！");
    }
}
